#include <iostream>

#include <map>


using namespace std;




class Node
{
	public:
		Node()
		{
		}
		Node(int nums):num(nums)
		{

		}
		~Node()
		{

		}

	private:
		int num;
};




class NodeMange
{
	public:
		NodeMange()
		{
		
		 }
		~NodeMange()
		{

		}
		void input()
		{
			for(int i = 0; i < 1000; i++)
			{
				Node one(i);
				manages.insert(make_pair(i,one));
			}
		}
		Node getOneByValue(int i)
		{
			Node one;
			map<int,Node>::iterator it = manages.find(i % 999);
			if(it != manages.end())
			{
				one = it->second;
			}
			return one;
		}
		Node& getOneByReference(int i)
		{
			map<int,Node>::iterator it = manages.find(i % 999);
			if(it != manages.end())
			{
				return it->second;
			}

		}
	private:
		map<int,Node> manages;

};



int main()
{
	NodeMange object;
	object.input();
	for(int i = 0; i < 1000000;i++)
	{
//		Node one = object.getOneByValue(i);
		Node one = object.getOneByReference(i);
	}
	return 0;
}
